package db4o;

import java.util.Set;

import pojo.Device;

public class DBUtils {

	public static Integer getMaxIdOfDevice() {
		// TODO: dosc lopatologiczna metoda ale dziala poki co
		DeviceRetriver ret = new DeviceRetriver();
		Set<Device> devices = ret.getAllDevices();
		int temp = 0;
		if (devices != null) {
			for (Device d : devices) {
				if (temp < d.getId())
					temp = d.getId();
			}
		}

		return (temp == 0) ? 1 : temp;
	}

//	public static void main(String[] args) {
//		// TODO Auto-generated method stub
//		System.out.println(getMaxIdOfDevice());
//		DeviceCreator creator = new DeviceCreator();
//		creator.devicePersist("zepsuty", EDeviceType.LAPTOP);
//		creator.devicePersist("zepsuty", EDeviceType.LAPTOP);
//		creator.devicePersist("zepsuty", EDeviceType.LAPTOP);
//
//	}

}
